package com.blue.comments.controller;

import com.blue.comments.service.CommentsService;
import com.litblue.starter.core.AjaxResult;
import com.litblue.starter.pojo.comments.domain.Comment;
import com.litblue.starter.pojo.comments.dto.TotalCommentsDto;
import com.litblue.starter.pojo.comments.vo.CommentVo;
import lombok.AllArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("comments")
@AllArgsConstructor(onConstructor_ = @Autowired)
public class CommentsController {

private final CommentsService commentsService;

    @PostMapping("addComment")
    AjaxResult addComment(@RequestBody Comment comment){
       return commentsService.addComment(comment);
    }
    @PostMapping("addCommentLike")
    AjaxResult addCommentLike(@RequestBody TotalCommentsDto totalCommentsDto){
        return commentsService.addCommentLike(totalCommentsDto);
    }

    @GetMapping("getComments")
    List<CommentVo> getComments(String artworkId){
       return commentsService.getComments(artworkId);
    }
}
